package org.wanda.pv.model.business;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import org.nutz.dao.entity.annotation.*;
import org.wanda.pv.framework.base.BaseModel;
import org.wanda.pv.model.basic.Point;
import org.wanda.pv.model.hy.HyDrawing;
import org.wanda.pv.model.hy.HyUserInfo;

import java.util.List;

@Table("wd_mark")
@Comment("标注")
public class Mark extends BaseModel{

    @Column
    @Id
    @Prev(els = {@EL("$me.idGen()")})
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    @Comment("项目ID")
    @Column("project_flow_children_node_id")
    private String projectFlowChildrenNodeId;


    @Comment("标注位置")
    @Column("mark_site")
    @ColDefine(type = ColType.TEXT)
    private String site;

    @Comment("是否通过")
    @Column("mark_passed")
    private boolean passed;


    @Comment("缩略图id")
    @Column("mark_thumbnail")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long thumbnail;


    @Comment("描述 ——  对标注的描述")
    @Column("description")
    @ColDefine(type = ColType.TEXT)
    private String description;

    @Comment("是否优化  0  否  1 是  2 优化")
    @Column("is_optimization")
    private int isOptimization;


    /** 设置标注与题目的关联关系 **/
    @Comment("要点ID")
    @Column("point_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long  pointId;

    @One(field = "pointId")
    private Point point;

    /** 设置图纸与标注的关联关系 **/
    @Comment("图纸ID")
    @Column("hy_drawing_id")
    @JsonSerialize(using = ToStringSerializer.class)
    private Long  drawingId;

    @Comment("标注其他方回复ID")
    @Column("mark_examines_content_id")
    private Long markExaminesContentId;

    @Comment("图纸")
    @One(field = "drawingId")
    private HyDrawing hyDrawing;

    @Comment("和标注审查内容的关系")
    @One(field = "markExaminesContentId")
    private MarkExaminesContent markExaminesContent;
    @Comment("用户ID")
    @Column("hy_user_info_id")
    private Long hyUserInfoId;

    @One(field = "hyUserInfoId")
    private HyUserInfo hyUserInfo;


    /** 设置标注与话题的关联关系 **/
    @ManyMany(relation = "wd_re_mark_topic",from = "mark_id", to = "topic_id")
    private List<Topic> topics;


    /** 设置标注和要点的关联关系 **/
    @ManyMany(relation = "wd_re_mark_point",from = "mark_id", to = "point_id")
    private List<Point> points;

    /** 设置标注与附件的关联关系 **/

    @Many(field = "markId")
    private List<Attachment> attachments;

    public Long getMarkExaminesContentId() {
        return markExaminesContentId;
    }

    public void setMarkExaminesContentId(Long markExaminesContentId) {
        this.markExaminesContentId = markExaminesContentId;
    }

    public MarkExaminesContent getMarkExaminesContent() {
        return markExaminesContent;
    }

    public void setMarkExaminesContent(MarkExaminesContent markExaminesContent) {
        this.markExaminesContent = markExaminesContent;
    }

    public int getIsOptimization() {
        return isOptimization;
    }

    public void setIsOptimization(int isOptimization) {
        this.isOptimization = isOptimization;
    }

    public boolean initPassed(){
        return false;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getProjectFlowChildrenNodeId() {
        return projectFlowChildrenNodeId;
    }

    public void setProjectFlowChildrenNodeId(String projectFlowChildrenNodeId) {
        this.projectFlowChildrenNodeId = projectFlowChildrenNodeId;
    }

    public String getSite() {
        return site;
    }

    public void setSite(String site) {
        this.site = site;
    }

    public boolean isPassed() {
        return passed;
    }

    public void setPassed(boolean passed) {
        this.passed = passed;
    }

    public Long getThumbnail() {
        return thumbnail;
    }

    public void setThumbnail(Long thumbnail) {
        this.thumbnail = thumbnail;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Long getPointId() {
        return pointId;
    }

    public void setPointId(Long pointId) {
        this.pointId = pointId;
    }

    public Point getPoint() {
        return point;
    }

    public void setPoint(Point point) {
        this.point = point;
    }

    public Long getDrawingId() {
        return drawingId;
    }

    public void setDrawingId(Long drawingId) {
        this.drawingId = drawingId;
    }

    public HyDrawing getHyDrawing() {
        return hyDrawing;
    }

    public void setHyDrawing(HyDrawing hyDrawing) {
        this.hyDrawing = hyDrawing;
    }

    public HyUserInfo getHyUserInfo() {
        return hyUserInfo;
    }

    public void setHyUserInfo(HyUserInfo hyUserInfo) {
        this.hyUserInfo = hyUserInfo;
    }

    public Long getHyUserInfoId() {
        return hyUserInfoId;
    }

    public void setHyUserInfoId(Long hyUserInfoId) {
        this.hyUserInfoId = hyUserInfoId;
    }

    public List<Topic> getTopics() {
        return topics;
    }

    public void setTopics(List<Topic> topics) {
        this.topics = topics;
    }

    public List<Point> getPoints() {
        return points;
    }

    public void setPoints(List<Point> points) {
        this.points = points;
    }

    public List<Attachment> getAttachments() {
        return attachments;
    }

    public void setAttachments(List<Attachment> attachments) {
        this.attachments = attachments;
    }
}
